# @Time    :2025/4/8 8:34
"""
2.使用threading模块创建两个线程，一个线程打印10次"Hello"，另一个线程打印10次"World"。
"""
import threading


def print_hello():
    for _ in range(10):
        print("Hello")


def print_world():
    for _ in range(10):
        print("World")


if __name__ == "__main__":
    # 创建线程
    thread1 = threading.Thread(target=print_hello)
    thread2 = threading.Thread(target=print_world)

    # 启动线程
    thread1.start()
    thread2.start()

    # 阻塞主线程 等待线程完成
    thread1.join()
    thread2.join()
